function save_csv(struct_data,new_folder_path,subject_num,Files,j)

% filename2 = 'SaveFile2.csv';
% fid2 = fopen(filename2, 'w');
% for j=1:10
%     a=i;
%     b=rand(1,10);
%     fprintf(fid2, ['%d',',','%s','\n'], a,num2str(b));
% end

% save .csv file
file_name = strcat(new_folder_path{1,1},'\',subject_num,'_',regexp(Files(j).name, '\.', 'split'),'_roi.csv');
%fid = fopen(strcat(synergy_sim_save,file_name{1,1},'_roi.csv'), 'w');

%struct2table
data_table = struct2table(struct_data);
writetable(data_table,file_name{1,1})

end

